package tmt.usercenter.web.domain.security;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.tmt.annotation.Select2OptionValue;
import com.voodoodyne.jackson.jsog.JSOGGenerator;
import lombok.Getter;
import lombok.Setter;
import tmt.usercenter.web.domain.BaseCreator;
import tmt.usercenter.web.domain.TmtUser;
import tmt.usercenter.web.domain.enums.AuditStatus;

import javax.persistence.*;
import java.util.Date;

/**
 * 带审核信息的实体
 * Created by ThreeManTeam on 2017/4/21.
 */

@Getter
@Setter
@MappedSuperclass
@JsonIdentityInfo(generator = JSOGGenerator.class)
public class BaseAuditor extends BaseCreator {

	/**
	 * 审核状态
	 */
	@Select2OptionValue("auditStatus")
	@Enumerated(EnumType.STRING)
	@Column
	private AuditStatus auditStatus = AuditStatus.NOT_APPLY;

	/**
	 * 审核时间
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column
	private Date auditTime;

	/**
	 * 审核备注
	 */
	@Column
	private String auditNote;

	/**
	 * 审核人
	 */
	@ManyToOne(cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY)
	@JoinColumn(name = "auditor_id")
	private TmtUser auditor;


	/**
	 * 是否是审核动作。
	 */
	@Transient
	private boolean auditAction = false;

}
